<!--
 * @Author: 郝奔 1425466221@qq.com
 * @Date: 2023-07-11 10:48:33
 * @LastEditors: 郝奔 1425466221@qq.com
 * @LastEditTime: 2024-07-22 10:12:54
 * @Description: 
 * Copyright (c) 2024-present HBIS Digital Technology Co.,Ltd. All rights reserved. 
-->
<template>
  <div>
    <template v-for="(item, index) in options">
      <template v-if="values.includes(item.value)">
        <span v-if="item.elTagType == 'default' || item.elTagType == '' || tag == false
      " :key="item.value" :index="index" :class="item.elTagType">{{ item.label }}</span>

        <el-tag v-else :disable-transitions="true" :key="item.value + ''" :index="index"
          :type="item.elTagType === 'primary' ? '' : item.elTagType" :class="item.elTagType">{{ item.label }}</el-tag>
      </template>
    </template>
  </div>
</template>

<script setup>
import { computed } from "vue";

const props = defineProps({
  // 数据
  options: {
    type: Array,
    default: null,
  },
  // tag: false,
  // 当前的值
  value: [Number, String, Array],
});

const values = computed(() => {
  if (props.value !== null && typeof props.value !== "undefined") {
    return Array.isArray(props.value) ? props.value : [String(props.value)];
  } else {
    return [];
  }
});
</script>

<style scoped>
.el-tag+.el-tag {
  margin-left: 10px;
}
</style>
